<ul class="breadcrumb">
    <li>
        <a href="/">首页</a> <span class="divider">/</span>
    </li>
    <li>
        <a href="#">系统管理</a> <span class="divider">/</span>
    </li>
    <li>
        <a href="/_system/role/">角色管理</a> <span class="divider">/</span>
    </li>
    <li class="active">
        <?= ($action == 'add' ? '添加' : '编辑') ?>角色
    </li>
</ul>

<form class="form-horizontal" method="post" action="/_system/role/<?= $action ?>" target="form_target_ifrm">
    <input type="hidden" name="role_id" value="<?= $theOne['role_id'] ?>" />
    <fieldset>
        <legend><?= ($action == 'add' ? '添加' : '编辑') ?>角色</legend>
        <div class="control-group">
            <label for="role_name" class="control-label">角色名</label>
            <div class="controls">
                <input type="text" id="role_name" name="role_name" class="input-large" value="<?= $theOne['role_name'] ?>" />
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">分配权限 <br /> <input type="checkbox" onclick="checkAll('privileges', this)"> 全选/反选</label>
            <div class="controls">
                <? if ($privList): ?>
                    <? foreach ($privList as $controller => $methods): ?>
                        <? if ($methods): ?>
                            <? foreach ($methods as $value): ?>
                                <label class="checkbox">
                                    <? $checked = ($privChecked && in_array($value['priv_id'], $privChecked)) ? 'checked' : ''; ?>
                                    <input type="checkbox" value="<?= $value['priv_id'] ?>" name="privileges[]" <?= $checked ?> /> <?= $value['priv_name'] ?>
                                </label>
                            <? endforeach; ?>
                        <? endif; ?>
                        <hr style="margin: 8px 0;" />
                    <? endforeach; ?>
                <? endif; ?>
            </div>
        </div>
        <div class="form-actions">
            <button class="btn btn-primary btn-large" type="submit">提交</button>
            <button class="btn btn-large" type="button" onclick="history.back();">返回</button>
        </div>
    </fieldset>
</form>